<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%String path = request.getContextPath() ;%>
<%@ taglib uri="/WEB-INF/tld/c.tld" prefix="c" %> 
<%@ taglib uri="/WEB-INF/tld/ui.tld" prefix="ui" %>
<%@ taglib uri="/WEB-INF/tld/sys.tld" prefix="sys" %>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>证件解绑</title>
<jsp:include page="../../import.jsp" flush="true" />
</head>
<body class="iframeBody">
<div class="Wrapper">
<div class="searchArea">
    <form id="searchBar">
        <div class="fieldset1 clearFix">
        	<div class="FXBR">
	            <div class="fieldBox">
	                <div class="label">客户名称</div>
	                <div class="field">
	                    <input name="cstNm" id="cstNm" type="text" class="ui-textbox" value="" ligerui="width: 160">
	                </div>
	            </div>
	            <div class="fieldBox">
	                <div class="label">证件号码</div>
	                <div class="field">
	                    <input name="certNo" id="certNo" type="text" class="ui-textbox" value="" ligerui="width: 160">
	                </div>
	            </div>
	            <div class="fieldBox">
	                <div class="label">客户类型</div>
	                <div class="field">
	                    <select name="cstTypCd" id="cstTypCd" ligerui="width: 160">
	                        <option value=" " seleted>请选择</option>
	                       <c:forEach items="${searchSelectCsttypcdlist }" var="csttypcd">
	                        	<option value="${csttypcd.key }">${csttypcd.value }</option>
	                        </c:forEach>
	                    </select>
	                </div>
	            </div>
            </div>
            
            <div class="clearFix"></div>
	            <div class="btnsBox formBtns notRight">
	               <span id="searchBtn" class="sq-button-round">查询</span>
	               <span id="clearBtn" class="sq-button-round">清空</span>
	               <input id="resetBtn" type="reset" value="重置" class="l-button l-button-reset Hide"/>
	            	<%-- <a target="_blank" href="<%=path%>/system/sysulfilesrec/downLoad.do?fileName='我是谁'&filePath='attachments/11000/customer/20170406/5df071c5f6da4255b5a9a0f4a4ae3bda.png'">下载附件</a> --%>
	            </div>
        	</div>
        </form>
    </div>
</div>
<div id="ligergrid1" class="sq-grid"></div>
</div>

<!-- 客户类型 -->
<div id="div_customer_type" style="display:none">
	<form id="div_customer_type_form">
            <div class="fieldset1 tabel_col tabel_col_s clearFix noBorder">
			    <div class="fieldBox col_50">
			         <div class="label">客户类型</div>
			         <div class="field">
			               <select name="win_select_customer_type" id="win_select_customer_type" data-value="" validate="{required:true, select: true}">
		                       	<option value="">请选择</option>
		                        <c:forEach items="${searchSelectCsttypcdlist }" var="csttypcd" begin="0" step="1" varStatus="status">
		                        	<c:if test="${csttypcd.key == 1}">
					                    <option value="${csttypcd.key }">${csttypcd.value }</option>
					                </c:if>
					                <c:if test="${csttypcd.key != 1}">
					                    <option value="${csttypcd.key }">${csttypcd.value }</option>
					                </c:if>
		                        </c:forEach>
		                    </select>
			              <span class="requiredSymbol">*</span>
			         </div>
			    </div>
				<!-- 可以处理隐藏操作-自然人 -->
				<div id="win_np_block_id" style="display:block">
					<div class="fieldBox col_50">
						<div class="label" id="div_customer_name_column_tip">客户名称</div>
						<div class="field">
							<input name="winNpCstNm" id="winNpCstNm" type="text" class="ui-textbox" value="" validate="{required:true,nmcharacter:true,maxlength:20}">
	                    <span class="requiredSymbol">*</span>
						</div>
					</div>
					<div class="fieldBox col_50">
						<div class="label">证件类型</div>
						<div class="field">
							<select name="winCertTypCd" id="winCertTypCd" data-value="" validate="{required:true, select: true}">
			              <c:forEach items="${searchSelectCertTypCdList }" var="kv" begin="0" step="1" varStatus="status">
							 <c:if test="${status.index == 0}">
								<option value="${kv.key }" checked >${kv.value }</option>
							 </c:if>
							  <c:if test="${status.index != 0}">
									<option value="${kv.key }">${kv.value }</option>
							  </c:if>
						  </c:forEach>
			          </select>
			         <span class="requiredSymbol">*</span>
						</div>
					</div>
					<div class="fieldBox col_50">
						<div class="label" id="div_customer_type_column_tip">证件号</div>
							<div class="field">
								<input name="winNpCertNo" id="winNpCertNo" type="text" class="ui-textbox" value="" validate="{required:true}">
		                    	<span class="requiredSymbol">*</span>
					        	<span class="addNpVerifyID" id="sNpVerifyID">
		                        	<a href="javascript:;" id="addNpVerifyID" pass='n' class="liger_tip" title="未验证"><i class="sqIco sqIco_8"></i></a>
		                    	</span>
						   </div>
					</div>
				</div>
				
				<!-- 可以处理隐藏操作-法人 -->
				<div id="win_corp_block_id" style="display:none">
					<div class="fieldBox col_50">
						<div class="label" id="div_customer_name_column_tip">客户名称</div>
						<div class="field">
							<input name="corpCstNm" id="corpCstNm" type="text" class="ui-textbox" value="" validate="{required:true,maxlength:30}">
	                    <span class="requiredSymbol">*</span>
						</div>
					</div>
					<div class="fieldBox col_50">
			         <div class="label">证件类型</div>
			         <div class="field">
			           <select name="corpCertTypCd" id="corpCertTypCd" data-value="" validate="{required:true, select: true}">
			              <c:forEach items="${searchSelectLPCertTypCdList }" var="kv" begin="0" step="1" varStatus="status">
							 <c:if test="${status.index == 0}">
								<option value="${kv.key }" checked >${kv.value }</option>
							 </c:if>
							  <c:if test="${status.index != 0}">
									<option value="${kv.key }">${kv.value }</option>
							  </c:if>
						  </c:forEach>
			          </select>
			         <span class="requiredSymbol">*</span>
			    	</div>
				    </div>
					
					<div class="fieldBox col_50">
						<div class="label" id="div_customer_type_column_tip">证件证号</div>
							<div class="field">
								<input name="corpCertNo" id="corpCertNo" type="text" class="ui-textbox" value="" validate="{required:true}">
		                    	<span class="requiredSymbol">*</span>
						   </div>
					</div>
					
					<div class="fieldBox col_50">
						<div class="label" id="div_customer_name_column_tip">法定代表人</div>
						<div class="field">
							<input name="corpLowerNm" id="corpLowerNm" type="text" class="ui-textbox" value="" validate="{required:true,nmcharacter:true,maxlength:20}">
	                    <span class="requiredSymbol">*</span>
						</div>
					</div>
					<div class="fieldBox col_50">
						<div class="label">法人证件类型</div>
						<div class="field">
							<select name="corpForCertTypCd" id="corpForCertTypCd" data-value="" validate="{required:true, select: true}">
			              <c:forEach items="${searchSelectCertTypCdList }" var="kv" begin="0" step="1" varStatus="status">
							 <c:if test="${status.index == 0}">
								<option value="${kv.key }" checked >${kv.value }</option>
							 </c:if>
							  <c:if test="${status.index != 0}">
									<option value="${kv.key }">${kv.value }</option>
							  </c:if>
						  </c:forEach>
			          </select>
			         <span class="requiredSymbol">*</span>
						</div>
					</div>
					<div class="fieldBox col_50">
						<div class="label">法人证件号码</div>
							<div class="field">
								<input name="corpLowerCertNo" id="corpLowerCertNo" type="text" class="ui-textbox" value="" validate="{required:true}">
		                    	<span class="requiredSymbol">*</span>
					        	<span class="addNpVerifyID" id="sCorpVerifyId">
		                        	<a href="javascript:;" id="addCorpVerifyID" pass='n' class="liger_tip" title="未验证"><i class="sqIco sqIco_8"></i></a>
		                    	</span>
						   </div>
					</div>
				</div>
			</div>
        </form>
</div>

<script type="text/javascript">
	var grid = null;
	var _mySelfIDImgUrl="";//我自己的身份证图片地址,待验证过后返回
	$(function () {
	    initForm();
		initGrid();//注意初始化要在initForm之后,因为在初始化grid的时候需要form参数
	    searchBtnEvent();
	    clearBtnEvent();
	    npVerifyIDEvent();
	});
	
	//清空按钮事件
	function clearBtnEvent(){
		 $("#clearBtn").click(function(event) {
		        $("#resetBtn").click();  //重置 input-text
		        var form = liger.get("searchBar");
		        form.setData({  //重置select等特殊表单
		            "cstTypCd":" ",
		            "cstRlTyp":" "
		        });
 				liger.get("buOrgCd").clear();//清空树
		 });
	}
	
	//初始化表单
	function initForm(){
		$("#searchBar").ligerForm();
	}
	
	//查询按钮事件
	function searchBtnEvent(){
		 $("#searchBtn").click(function(event) {
	         var form = new liger.get("searchBar");
	         var data = form.getData();
	         data["crtTm"] = $("#crtTm").val();
	         //alert(JSON.stringify(data));
	         for (name in data){
	            grid.setParm(name,data[name]);
	         };
	        grid.reload();
	    });
	}
	
	//查询参数
	function getSearchParams(){
		var form = new liger.get("searchBar");
        var data = form.getData();
        data["isAuth"] = "true";
        return data;
	}
	
	//初始化列表
	function initGrid(){
		$("#ligergrid1").ligerGrid({
	    	url: '<%=path%>/customer/cstbscinfo/initAllList.do',
	    	method : 'get',
	    	parms:getSearchParams(),
	        columns: [
	            { display: '客户名称', name: 'cstNm', minWidth: 180 , align:'center', enabledSort:true,
	            	render: function (rowdata, rowindex, value, column) { 
	            		if(StringUtils.isEmpty(value)){
	                		value = "";
	                	}
	            		var h = '';
	            		    h='<a href="javascript:showDetail(';
	                        h+="'"+rowdata.id+"'";
	                        h+=",'"+rowdata.cstTypCd+"'";
	                        h+=')">'+value+'</a>'
	                        return h;
	            		}},
	            { display: '客户性质', name: 'cstStsCdNm', width: 120, enabledSort:true },
	            /* { display: '客户级别', name: 'cstLvlCdNm', width: 120 , enabledSort:true}, */
	            { display: '客户类型', name: 'cstTypCd', width: 1,align:'left', enabledSort:true, hide:true},
	            { display: '客户类型', name: 'cstTypCdNm', width: 120, enabledSort:true},
	            { display: '证件/组织机构代码', name: 'certNo', width: 160, align:'center', enabledSort:true},
	            { display: '创建时间', name: 'crtTm', width: 180 , render:renderDate, enabledSort:true},
	            getGridOperColumnContent()
	        ],
	        pageSize:10,
	        root:'rows',
	        record:'total',
	        hideLoadButton : false,
	        width: '100%',
	        height:'100%',
	        heightDiff:-2,
	        checkbox:true,
	        rownumbers:true
	    });
	    grid = liger.get("ligergrid1");
	    grid.setHeight(100);
	    grid.options.isSingleCheck=true;
	}
	
	//隐藏掉操作列
    function getGridOperColumnContent(){
    	var data = {
                display: '操作',
                isSort: false,
                width: 250,
                align:'left',
                render: function (rowdata, rowindex, value){
                        var h = '';
						var v = '<a class="sq-button-hasicon" alt="证件解绑" href="javascript:certRemoveBindRow(';
							v += "'"+rowdata.certNo+"'";
							v += ",'ligergrid_bankacc'"
							v += ")\"><i class=\"sqBtnIco_4\"></i>"+LogUtils.LOG_CUST_GRID_REMOVE_BIND+"</a>";

							if (rowdata.usrId != null && rowdata.usrId != ""){
								h = v;
							}

                    return h;
                }
        	 }
        	return data;
	}
	
	//格式化时间
	function renderDate(rowdata, index, value){
		var dateStr = "";
		if(null != value){
			var date = new Date(value);
			dateStr = DateUtils.formatDate(date, DateUtils.YYYY_MM_DDHHMMSS);
		}
		return dateStr;
	}

	
	//查看数据
	function showDetail(_id,_cstTypCd){
		//1 自然人  2 法人
		if(_cstTypCd == 1){
			parent.mainApp.f_addTab('tab_customer_np_detail'+_id,'客户详情','<%=path%>/customer/cstbscinfo/toCustCstBacInfoNpDetailPage.do?id='+_id);
		}else if(_cstTypCd == 2){
			parent.mainApp.f_addTab('tab_customer_corp_detail'+_id,'客户详情','<%=path%>/customer/cstbscinfo/toCustCstBacInfoCorpDetailPage.do?id='+_id);
		}
	}
	
	//点击自然人保存按钮
	function saveNpInfo(){
		if (!ligerPersonForm.valid()) {
            UIUtils.alertWarning(LogUtils.LOG_CMM_MUST_FIX_ITEM_INFO);
            return false; //验证不通过，不执行以下代码
        }
        var data = ligerPersonForm.getData();
        //处理接收参数
        //1 自然人  2法人
      	if(data.win_select_customer_type == CustomerConstant.CST_TYPE_NP_CD){
      		if($("#winCertTypCd").val()==0){
      		//必须是身份证验证通过才行
          		if($("#addNpVerifyID").attr("pass") == 'n'){
          			UIUtils.alertWarning("请验证身份证信息是否正确!");
        			return;
        		}
      		}
      		data["npCertTypCd"] = data.winCertTypCd;
            data["cstNm"] = data.winNpCstNm;
      		data["certNo"] = data.winNpCertNo;
      		toCheckNpPage(data);//传递表单数据         		
      	}else if(data.win_select_customer_type == CustomerConstant.CST_TYPE_CORP_CD){
      		if($("#corpForCertTypCd").val()==0){
      		//必须是身份证验证通过才行
      			if($("#addCorpVerifyID").attr("pass") == 'n'){
          			UIUtils.alertWarning("请验证身份证信息是否正确!");
        			return;
        		}
      		}
            data["cstNm"] = data.corpCstNm;
      		data["certNo"] = data.corpCertNo;
      		data["certTypCd"] = data.corpCertTypCd;
      		data["corpForCertTypCd"] = data.corpForCertTypCd;
      		checkExistCorpInfo(data);
      	}else{
      		UIUtils.alertWarning("请选择新增类型!");
      	}
	}
	
	//重置新增选择表单
	function resetAddCstNpForm(ligerPersonForm){
		//赋值给验证图标默认值
	    $("#sNpVerifyID").html(getVerfiedIDHtmlDefault());
	    $("#sCorpVerifyId").html(getCorpVerfiedIDHtmlDefault());
		//清理自然人数据
		$("#winNpCstNm").val("");
		$("#winCertTypCd").val("");
		$("#winNpCertNo").val("");
	    //清理法人数据
		$("#corpCertTypCd").val("");
		$("#corpCertNo").val("");
		$("#corpForCertTypCd").val("");
		$("#corpLowerNm").val("");
		$("#corpLowerCertNo").val("");
		$("#corpCstNm").val("");
		
		//释放自然人
		liger.get("win_select_customer_type").setEnabled();
		liger.get("winNpCstNm").setEnabled();
		liger.get("winCertTypCd").setEnabled();
        liger.get("winNpCertNo").setEnabled();
        //释放法人
        liger.get("corpCstNm").setEnabled();
        liger.get("corpLowerNm").setEnabled();
        liger.get("corpForCertTypCd").setEnabled();
        liger.get("corpLowerCertNo").setEnabled();
	}
	
	//检查是否存在客户信息
	function checkExistCorpInfo(data){
		var _url = '<%=path%>/customer/cstbscinfo/getExistCorp.do';
		AjaxUtils.ajaxGet(_url, data, function(msg){
			if(msg.success == 1){
				 $.ligerDialog.SQconfirm(LogUtils.LOG_CUST_INFO_EXIST, function (flag) {
   					if(flag == true){
   						var _id = msg.data.cId;
   						parent.mainApp.f_addTab('tab_customer_corp_update'+_id,'修改客户','<%=path%>/customer/cstbscinfo/toCustCstBacInfoCorpAddPage.do?id='+_id);
   						$.ligerDialog.hide();//关闭新增窗口
   					}
				});
			 }else if(msg.success == 3){//可以跳转
				 var param = "?cstNm="+data.cstNm+"&certNo="+data.certNo+"&certTypCd="+data.certTypCd
   				 +"&corpLowerNm="+data.corpLowerNm
   				 +"&corpForCertTypCd="+data.corpForCertTypCd
   				 +"&corpLowerCertNo="+data.corpLowerCertNo;
				 var timestamp = (new Date()).valueOf();
				 parent.mainApp.f_addTab('addCorpCustomer'+timestamp,'新增客户','<%=path%>/customer/cstbscinfo/toCustCstBacInfoCorpAddPage.do'+param);
				 $.ligerDialog.hide();//关闭新增窗口
			 }else if(msg.success == 2){
				 UIUtils.alertError(msg.info);
			 }
		},true);
	};
	
	//跳转到修改自然人界面
	function toCheckNpPage(data){
		var _url = '<%=path%>/customer/cstbscinfo/getExistNp.do';
		AjaxUtils.ajaxGet(_url, data, function(msg){
			if(msg.success == 1){
				 $.ligerDialog.SQconfirm(LogUtils.LOG_CUST_INFO_EXIST, function (flag) {
   					 if(flag == true){
   						 //跳转到修改页面
   						 var _id = msg.data.cId;
   						 parent.mainApp.f_addTab('tab_customer_np_update'+_id,'修改客户','<%=path%>/customer/cstbscinfo/toCustCstBacInfoNpAddPage.do?id='+_id);
   						 $.ligerDialog.hide();//关闭新增窗口
   					 }	
					});
			 }else if(msg.success == 3){
				 //跳转到新增页面
				 var param = "?cstNm="+data.cstNm+"&certNo="+data.certNo+"&npCertTypCd="+data.npCertTypCd+"&imgUrl="+_mySelfIDImgUrl;
				 var timestamp = (new Date()).valueOf();
				 parent.mainApp.f_addTab("addNpCustomer"+timestamp,"新增客户","<%=path%>/customer/cstbscinfo/toCustCstBacInfoNpAddPage.do"+param);
				 $.ligerDialog.hide();//关闭新增窗口
			 }else{
				 UIUtils.alertError(msg.info);
			 }
		},true);
	}
	
	//更新
	function modifyRow(_id, _cstTypCd){
		//1 自然人  2 法人
		if(_cstTypCd == 1){
			parent.mainApp.f_addTab('tab_customer_np_update'+_id,'修改客户','<%=path%>/customer/cstbscinfo/toCustCstBacInfoNpAddPage.do?id='+_id);
		}else if(_cstTypCd == 2){
			parent.mainApp.f_addTab('tab_customer_corp_update'+_id,'修改客户','<%=path%>/customer/cstbscinfo/toCustCstBacInfoCorpAddPage.do?id='+_id);
		}
	}
	
	//创建项目
	function createProjectRow(_cstId, _cstNm){
		var callback = function(){
			//alert("callback");
		}
		var fromPrjFlag = false;
		var params = "?cstId="+_cstId+"&fromPrjFlag="+fromPrjFlag+"&cstNm="+_cstNm;
		var timestamp = (new Date()).valueOf();
		Add_navTab('tab_prj_bsc_info_add'+timestamp,'添加项目信息','<%=path%>/project/prjbscinfo/toAddPage.do'+params,callback);
	}
	//证件解绑
    function certRemoveBindRow(_certNo){
        $.ligerDialog.confirm('确定解除吗?', function (flag) {
            if (flag == false)return;
            if (_certNo == null || _certNo == '') return;
            $.ajax({
                type: 'POST',
                dataType: 'json',
                data: {certNo: _certNo},
                url: '<%=path%>/customer/cstbscinfo/removeBind.do',
                beforeSend: function () {
                    wait_dialog = $.ligerDialog.SQalert({
                        content: LogUtils.LOG_CMM_DATA_LOADING,
                        SQ_type: "waitting"
                    });
                },
                success: function (msg) {
                    wait_dialog.close();
                    if (msg.success == 1) {
                        $.ligerDialog.SQalert({
                            content: msg.info,
                            SQ_type: "success"
                        });
                        grid.reload();
                    } else {
                        $.ligerDialog.SQalert({
                            content: msg.info,
                            SQ_type: "error"
                        });
                    }
                }
            });
        })
	}
	
	function checkIsOrNot(){
		$("#winCertTypCd").change(function(event) {
			if($(this).val()==0){
				$("#sNpVerifyID").show();
			}else{
				$("#sNpVerifyID").hide();
			}
		});
		$("#corpForCertTypCd").change(function(event) {
			if($(this).val()==0){
				$("#sCorpVerifyId").show();
			}else{
				$("#sCorpVerifyId").hide();
			}
		});
		
	}
	
	//客户类型选择事件
	function winSelectCustomerTypeChangeEvent(){
		$("#win_select_customer_type").change(function(event) {
			var div_customer_type_form = liger.get("div_customer_type_form");
            var typ =$(this).val();
            if (typ == CustomerConstant.CST_TYPE_NP_CD) {
            	$("#win_corp_block_id").css('display','none'); 
            	$("#win_np_block_id").css('display','block'); 
            	
            	//取消法人验证
            	div_customer_type_form.setFieldValidate("corpCstNm", {
            		required: false,
                    maxlength:30
                });
            	
            	div_customer_type_form.setFieldValidate("corpCertTypCd", {
                    required: false,
                    select: false
                });
            	
            	div_customer_type_form.setFieldValidate("corpForCertTypCd", {
                    required: false,
                    select: false
                });
            	
            	div_customer_type_form.setFieldValidate("corpCertNo", {
                    required: false
                });
            	div_customer_type_form.setFieldValidate("corpLowerNm", {
                    required: false,
                    nmcharacter:true,
                    maxlength:20
                });
            	div_customer_type_form.setFieldValidate("corpLowerCertNo", {
                    required: false,
                    idcardno: false
                });
            	
            	//添加自然人验证
            	div_customer_type_form.setFieldValidate("winNpCertNo", {
                    required: true
                });
            	
            	div_customer_type_form.setFieldValidate("winNpCstNm", {
            		required: true,
                    nmcharacter:true,
                    maxlength:20
                });
            	
            	div_customer_type_form.setFieldValidate("winCertTypCd", {
                    required: true,
                    select: true
                });
            	
            }else if (typ == CustomerConstant.CST_TYPE_CORP_CD) {
            	//显示法人, 隐藏自然人
            	$("#win_corp_block_id").css('display','block'); 
            	$("#win_np_block_id").css('display','none'); 
            	
            	//取消自然人验证
            	div_customer_type_form.setFieldValidate("winNpCstNm", {
                    required: false,
                    nmcharacter:true,
                    maxlength:20
                });
            	
            	div_customer_type_form.setFieldValidate("winNpCertNo", {
                    required: false
                });
            	
            	div_customer_type_form.setFieldValidate("winCertTypCd", {
                    required: false,
                    select: false
                });
            	
            	//新增法人验证
            	
            	div_customer_type_form.setFieldValidate("corpCstNm", {
            		required: true,
                    maxlength:30
                });
            	
            	div_customer_type_form.setFieldValidate("corpCertTypCd", {
                    required: true,
                    select: true
                });
            	div_customer_type_form.setFieldValidate("corpForCertTypCd", {
                    required: true,
                    select: true
                });
            	div_customer_type_form.setFieldValidate("corpCertNo", {
                    required: true
                });
            	div_customer_type_form.setFieldValidate("corpLowerNm", {
                    required: true,
                    nmcharacter:true,
                    maxlength:20
                });
            	div_customer_type_form.setFieldValidate("corpLowerCertNo", {
                    required: true,
                    idcardno: false,
                    maxlength:18
                });
            	
            }else{
            	$.ligerDialog.SQalert({content: "客户类型无效!", SQ_type: "warning"});
            }
        });
	}
	
	 //身份证第三方验证事件-自然人
    function npVerifyIDEvent(){
    	$(".addNpVerifyID").on('click', function(event) {
    		//这里要区分当前是选择的自然人还是法人
    		var currentType = $("#win_select_customer_type").val();
    		if(currentType == CustomerConstant.CST_TYPE_NP_CD){
    			if($("#addNpVerifyID").attr("pass") == 'y'){
        			return;
        		}
    		}else if(currentType == CustomerConstant.CST_TYPE_CORP_CD){
    			if($("#addCorpVerifyID").attr("pass") == 'y'){
        			return;
        		}
    		}else{
    			return;
    		}
    		
    		//上面是一个完成验证,如果完成了就停止,下面继续
    		var _this = this;
            var wait_dialog = UIUtils.alertWaiting(LogUtils.LOG_CMM_DATA_LOADING);
            var data = ligerPersonForm.getData();
            var cstNm;//客户名称
            var certNo;//证件号码
            var validNmTip;
            var validNoTip;
    		if(currentType == CustomerConstant.CST_TYPE_NP_CD){
    			if($("#addNpVerifyID").attr("pass") == 'y'){
        			return;
        		}
    			cstNm = data.winNpCstNm;//客户名称
    	        certNo = data.winNpCertNo;//身份证号码
    	        validNmTip = LogUtils.LOG_CUST_NAME_NOT_EMPTY;
    	        validNoTip = LogUtils.LOG_CUST_ID_CARD_NOT_EMPTY;
    	        
    		}else if(currentType == CustomerConstant.CST_TYPE_CORP_CD){
    			if($("#addCorpVerifyID").attr("pass") == 'y'){
        			return;
        		}
    			cstNm = data.corpLowerNm;//法定代表人名称
    	        certNo = data.corpLowerCertNo;//法定代表人身份证号码
    	        validNmTip = LogUtils.LOG_CUST_CORP_NAME_NOT_EMPTY;
    	        validNoTip = LogUtils.LOG_CUST_CORP_ID_CARD_VALID_NO_PASS;
    		}
            
            if(!cstNm){
            	wait_dialog.close();
            	UIUtils.alertWarning(validNmTip);
                return; //验证不通过，不执行以下代码
            }
            if(!certNo){
            	wait_dialog.close();
            	UIUtils.alertWarning(validNmTip);
                return; //验证不通过，不执行以下代码
            }
            
            _mySelfIDImgUrl = "";//每次验证都要赋空值在赋新值
            
            $.ajax({
           		type: 'post',
           		dataType:'json',
           		data:{cstNm:cstNm,certNo:certNo},
           		url: '<%=path%>/customer/cstbscinfo/validateIdCard.do',
           		success:function(msg){
           			 wait_dialog.close();
           			 if(msg.success == 1){
           				if(msg.data){
           					if(msg.data.absolutePath){
           						//把这个地址记录上,后面要随保存数据一起存储
           						_mySelfIDImgUrl = msg.data.absolutePath;
           					}
           				}
           				//说明已经三方验证通过
           				UIUtils.alertSuccess(msg.info);
                        //验证通过后直接禁用输入框
                        if(currentType == CustomerConstant.CST_TYPE_NP_CD){
                          	liger.get("winNpCstNm").setDisabled(true);
                            liger.get("winNpCertNo").setDisabled(true);
                            liger.get("winCertTypCd").setDisabled(true);
                            $(_this).closest(".addNpVerifyID").html(getVerfiedIDHtmlPass());
                    	}else if(currentType == CustomerConstant.CST_TYPE_CORP_CD){
                    		liger.get("corpLowerNm").setDisabled(true);
                            liger.get("corpLowerCertNo").setDisabled(true);
                            liger.get("corpForCertTypCd").setDisabled(true);
                            $(_this).closest(".addNpVerifyID").html(getCorpVerfiedIDHtmlPass());
                    	}
                        $(".liger_tip").ligerTip(); // HTML元素更新后，重新ligerTip实例化
           			 }else{//验证未通过
                         UIUtils.alertWarning(msg.info);
           			 }
           		}
            });
            
        });
    };
    
    //验证身份证未通过
    function getVerfiedIDHtmlNopass(){
    	var html="<a href='javascript:;' id='addNpVerifyID' pass='n' class='liger_tip' title='"+LogUtils.LOG_CMM_VALID_FAIL+"'><i class='sqIco sqIco_2'></i></a>";
    	return html;
    }
    
    //验证身份通过
    function getVerfiedIDHtmlPass(){
    	var html="<span class='liger_tip' id='addNpVerifyID' pass='y' title='"+LogUtils.LOG_CMM_VALID_PASS+"'><i class='sqIco sqIco_1'></i></span>";
    	return html;
    }
    
    //身份未验证标记
    function getVerfiedIDHtmlDefault(){
    	var html = "<a href=\"javascript:;\" id=\"addNpVerifyID\" pass='n' class=\"liger_tip\" title=\"未验证\"><i class=\"sqIco sqIco_8\"></i></a>";
    	return html;
    }
    
    
    //验证身份证未通过-法人
    function getCorpVerfiedIDHtmlNopass(){
    	var html="<a href='javascript:;' id='addCorpVerifyID' pass='n' class='liger_tip' title='"+LogUtils.LOG_CMM_VALID_FAIL+"'><i class='sqIco sqIco_2'></i></a>";
    	return html;
    }
    
    //验证身份通过-法人
    function getCorpVerfiedIDHtmlPass(){
    	var html="<span class='liger_tip' id='addCorpVerifyID' pass='y' title='"+LogUtils.LOG_CMM_VALID_PASS+"'><i class='sqIco sqIco_1'></i></span>";
    	return html;
    }
    
    //身份未验证标记-法人
    function getCorpVerfiedIDHtmlDefault(){
    	var html = "<a href=\"javascript:;\" id=\"addCorpVerifyID\" pass='n' class=\"liger_tip\" title=\"未验证\"><i class=\"sqIco sqIco_8\"></i></a>";
    	return html;
    }
	
	function clearBtn(){
		var form = new liger.get("searchBar");
		form.clear();
	}
	
	function iframeResize () {
	    if (parent.mainApp) {
	        parent.mainApp.parentTab.onResize();
	    };
	}
</script>

</body>
</html>